/**
 * 
 */
package com.geekteam.masterenglish.ui.fragment;

import com.geekteam.masterenglish.R;
import com.geekteam.masterenglish.Adapter.AlbumAdapter;

import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

/**
 * @author MTROL
 *
 */
public abstract class BaseListFragment extends BaseFragment implements LoaderCallbacks<Cursor>, OnItemClickListener{
	
	protected ListView mListView;
	protected AlbumAdapter mAdapter;
	protected int mType;
	
	public BaseListFragment(int type){
		mType = type;
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		return inflater.inflate(R.layout.fragment_list_lession, container, false);
	}
	
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		
		mListView = (ListView) getView().findViewById(R.id.list_lession);
		mAdapter = new AlbumAdapter(getActivity(), mType);
		mListView.setAdapter(mAdapter);
		mListView.setOnItemClickListener(this);
		getLoaderManager().initLoader(1, null, this);
	}
}
